import {} from 'antd-mobile'
import style from './index.module.less'
import Title from '@components/title'
import { formatDate, filterEmptyText, formatMoney } from '@js/tool'
import OrderLine from '@components/orderLine'

function Main ({ anti, data }) {
  return (
    <div className={style.container}>
      <Title title={`${anti ? '反' : ''}仲裁请求`} sub={formatDate(data.create_datetime, 'YYYY-MM-DD')}  />
      <div className={style.inner}>
        {
          data.items.map((li, i) => {
            return (
              <OrderLine key={i} index={i + 1} third value={(
                <div>
                  <div className={style['claim-item-title']}>
                    <span>{li.type === '标的收费' ? filterEmptyText(li.desc) : li.type}</span>
                    <span className={style.money}>（争议金额：{formatMoney(data.dispute_amount)}）</span>
                  </div>
                </div>
              )}/>
            )
          })
        }
        {
          data.statement && (
            <div className={style.statement}>
              <div className={style.title}>事实与理由：</div>
              <div className={style.content}>{data.statement || '无'}</div>
            </div>
          )
        }
        <div className={style['block-title']}>仲裁答辩</div>
        {
          data.defince.map((li, i) => {
            return (
              <OrderLine key={i} index={i + 1} third value={(
                <div>
                  <div className={style['dabian-item-title']}>
                    <span>{li.defender}</span>
                    <span>{formatDate(data.create_datetime, 'YYYY-MM-DD HH:mm')}</span>
                  </div>
                  <div className={style['dabian-statement']}>{li.statement}</div>
                  {
                    li.file && li.file.length > 0 && (
                      <div className={style.files}>
                        <span className={style['files-label']}>附件：</span>
                        <span className={style['files-value']}>
                          {li.file.map((li, i) => {
                            return (
                              <span className={style.file} key={i}>
                                <a href={li.url} target='_blank'>{li.original_filename}</a>
                              </span>
                            )
                          })}
                        </span>
                      </div>
                    )
                  }
                </div>
              )}/>
            )
          })
        }
      </div>
    </div>
  )
}

export default Main
